execShell

suspend fun execShell(command: String, shell: Shell = defaultShell, cwd: Path? = null, env: Map<String, String>? = null, input: <ERROR CLASS>? = null, silent: Boolean = false, outStream: <ERROR CLASS>? = null, errStream: <ERROR CLASS>? = null, failOnStdErr: Boolean = false, ignoreReturnCode: Boolean = false, delay: Long = 10000, stdoutListener: (<ERROR CLASS>) -> Unit? = null, stderrListener: (<ERROR CLASS>) -> Unit? = null, stdoutLineListener: (data: String) -> Unit? = null, stderrLineListener: (data: String) -> Unit? = null, debugListener: (data: String) -> Unit? = null)

Execute a command using the given or default shell. Pipes and redirection are supported. Only quotes and backticks are escaped in command.

Parameters

command

command to execute (can include additional args). Must be correctly escaped.

shell

the shell to use, defaultShell by default.

cwd

the working directory

env

the environment. Uses the current environment by default.

input

input to write to the subprocess's stdin

silent

whether to hide output

outStream

the output stream to use. Defaults to process.stdout.

errStream

the error stream to use. Defaults to process.stderr.

failOnStdErr

whether to fail if output is send to stderr

ignoreReturnCode

whether to not fail the process if the subprocess fails. Default throws an exception for non-0 return codes.

delay

How long in ms to wait for STDIO streams to close after the exit event of the process before terminating

stdoutListener

listener for stdout output

stderrListener

listener for stderr output

stdoutLineListener

listener for stdout output, called per line

stderrLineListener

listener for stderr output, called per line

debugListener

listener for debug output

Sources

js source
Link copied to clipboard